<template>
	<view class="">
		<view class="backCol64aeb4 h240r disFlex aliItCenter pl20r pr20r"
			@click="cliLogin"
		>
			<view class="w190r ">
				<image :src="token ? '/static/icons/iconUserAvatar.png' : '/static/icons/iconHeadPortrait.png'"
					mode="aspectFill"
					class="w140r h140r borRad50P bor3Srgba2412412410s5"
				></image>
			</view>
			<view class="flex1 colFff ">
				<view class="foWeiBold f36r" v-if="!token">
					立即登录
				</view>
				<view class="" v-else>
					<view class="foWeiBold f36r">
						{{userInfo.name}}
					</view>
					<view class="f24r mt15r">
						{{userInfo.phone}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
import { inquiryToLogin } from '@/utils/utils.js'
export default {
	data() {
		return {
			token: '',
			userInfo: {},
			
		}
	},
	onShow() {
		this.token = '';
		this.userInfo = {};
		inquiryToLogin().then(res => {//此项目中这种写法是弹确认框询问跳登录页
			// console.log(111, res)
			this.token = res;
			this.userInfo = uni.getStorageSync('userInfo');
		}).catch(err => {
			console.log(err)
		});
	},
	methods: {
		cliLogin() {
			if(this.token) {
				uni.navigateTo({ url: '/pages/personalCenter/userInformation' })
			}else {
				uni.navigateTo({ url: '/pages/personalCenter/login' })
			}
		}
	}
}

</script>
<style>
</style>